package edu.kpi.pzks2.queue;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import edu.kpi.pzks2.graph.Edge;
import edu.kpi.pzks2.graph.Node;
import edu.uci.ics.jung.graph.Graph;

public abstract class BaseQueueBuilder {

    public List<Node> buildQueue(Graph<Node, Edge> graph, Comparator<NodeStatistDescriptor> comp) {
        final List<NodeStatistDescriptor> descs = NodeStatistDescriptor.getNodeDescList(graph);
        Collections.sort(descs, comp);
        
        final List<Node> nodes = new ArrayList<Node>();
        for (NodeStatistDescriptor desc : descs) {
            nodes.add(desc.getNode());
        }
        
        return nodes;
    }

}
